TemplateForm= Ext.extend(
				Ext.Window,
				{
					formPanel : null,
					constructor : function(a) {
						Ext.applyIf(this, a);
						this.initUIComponents();
						TemplateForm.superclass.constructor.call(this, {
							layout : "fit",
							items : this.formPanel,
							modal : true,
							id : "TemplateFormWin",
							title : "模板管理",
							iconCls : "menu-materialTemplate",
							width : 400,
							height : 240,
							buttonAlign : "center",
							buttons : this.buttons
						});
					},
					initUIComponents : function() {
						this.formPanel = new Ext.FormPanel({
							url : __ctxPath + "/system/saveTemplate.do",
							layout : "form",
							id : "TemplateForm",
							border : false,
							bodyStyle : "padding:5px;",
							defaults : {
								anchor : "96%,96%"
							},
							formId : "TemplateFormId",
							defaultType : "textfield",
							labelWidth:90,
							items : [ {
								name : "template.id",
								xtype : "hidden",
								value : this.id == null ? "" : this.id
							}, {
								fieldLabel : "模板编号"+'<font color=red>*</font>',
								readOnly:true,
								hidden:true,
				                id:  "templatetNo",
				                name : "template.tNo",
								vtype : "alphanum",//alpha 只能输入字母，无法输入其他（如数字，特殊符号等）  alphanum  //只能输入字母和数字，无法输入其他  email     //email验证，要求的格式是"langsin@gmail.com" url       //url格式验证，要求的格式是[url]http://www.langsin.com[/url] 
						        vtypeText : "不是有效的模板编号",//错误提示信息,默认值我就不说了 
								allowBlank : true,
								blankText : "模板编号为空"
							}, {
								fieldLabel : "模板名称"+'<font color=red>*</font>',								
								name : "template.tName",
								allowBlank : false,
								blankText : "模板名称为空"
							}, {
								xtype : "combo",
								fieldLabel : "模板类别"+'<font color=red>*</font>',
								editable : false,
								allowBlank : false,
								id : "templatetTypecodeName",
								hiddenName : "template.tType.detailId",
								name : "template.tType.codeName",
								mode : "local",
								lazyInit : false,
								forceSelection : false,
								blankText : '请选择库房类别', 
								emptyText : '请选择库房类别', 			
								triggerAction : "all",
								store : new Ext.data.JsonStore({
									url : __ctxPath + "/system/listDicDetail.do?Q_dicType.dic_S_EQ=模版类别",
									autoLoad : true,
									autoShow : true,
									root : "result",
									idProperty : "detailId",
									fields : [ "detailId", "codeName" ],
									listeners :{   
				        			      load:function(){    
				        			      //Ext.getCmp('').setValue(Ext.getCmp('').getValue());  
				        			      }  
				            			}
								}),
								valueField : "detailId",
								displayField : "codeName"			
							},{
								fieldLabel : "默认模板",
								xtype : "checkbox",
								boxLabel: "设为默认",
								inputValue: '1',
								checked:false,
								name : "template.tDefault"
							}, {
								fieldLabel : "备注",
								xtype : "textarea",
								name : "template.remark",
								height:80
							}]
						});
						if (this.id != null && this.id != "undefined") {
							this.formPanel.loadData({
								url : __ctxPath
										+ "/system/getTemplate.do?id="
										+ this.id,
								preName : "template",
								root : "result"
							});
						}/*else{
							//添加编码
							Ext.Ajax.request({
								url : __ctxPath + "/common/getPtmsListNo.do",
								params : {
									lnIndex : "WLMB"
								},
								method : "post",
								success : function(a) {
									var result=Ext.util.JSON.decode(a.responseText); 
									if(result.success){									
										Ext.getCmp("template.tNo").setValue(result.lnNo);
									}
								}
							});
						}*/
						this.buttons = [ {
							text : "保存",
							iconCls : "btn-save",
							scope : this,
							handler : this.save.createCallback(this)
						}, {
							text : "取消",
							iconCls : "btn-cancel",
							scope : this,
							handler : function() {
								this.close();
							}
						} ];
					},
					save : function() {
						var b = Ext.getCmp("TemplateForm");
					    {
							if (b.getForm().isValid()) {
								b
										.getForm()
										.submit(
												{
													method : "post",
													waitMsg : "正在提交数据...",
													success : function(c, d) {
														Ext.ux.Toast.msg(
																"操作提示",
																"信息保存成功！");
														Ext.getCmp(
																"TemplateGrid")
																.getStore()
																.reload();
														Ext
																.getCmp(
																		"TemplateFormWin")
																.close();
													},
													failure : function(c, d) {
														Ext.MessageBox
																.show({
																	title : "操作提示",
																	msg : "信息保存出错，请联系管理员！",
																	buttons : Ext.MessageBox.OK,
																	icon : "ext-mb-error"
																});
														Ext
																.getCmp(
																		"TemplateFormWin")
																.close();
													}
												});
							}
						}
					}
				});